package lad02.test11;

public class Square extends Rectangle { int side;

    public double getDiagonal() {
        return Math.sqrt(side * side + side * side);
    }

    @Override
    public int getArea() {
        return side*side;
    }

    @Override
    public int getPerimeter() {
        return 4*side;
    }

    @Override
    public void printMyMay() {
        System.out.println("边长:" + side);
        System.out.println("面积:" + getArea());
        System.out.println("周长:" + getPerimeter());
        System.out.println("对角线:" + getDiagonal());
    }
}
